$(function () {
    $("#map").show();
    map();
    $("#charts").hide();
    $("#sunny").hide();
    $("#knowledge").hide();
    weather();

    $("#nav1").click(function () {
        changeShow("map");
    });
    $("#nav2").click(function () {
        changeShow("charts");
    });
    $("#nav3").click(function () {
        changeShow("sunny");
    });
    $("#nav4").click(function () {
        changeShow("knowledge");
    });
});

function weather() {
    var appid = '46582196';
    var sec = '3Sf8qhkY';
    $('#timeAndWea').leoweather({
        appid: appid, appsecret: sec,
        format: '<div class="top">' +
            '{年}年{月}月{日}日 {时}:{分}:{秒} 星期{周}' +
            '</div>' +
            '<div class="mid">' +
            '<div class="fl"><img src="./images/weather/{天气}.png" /></div>' +
            '<div class="fr"><span>{城市} {天气}</span><p>{最低气温}~{最高气温}</p><p>{风向}{风级}</p></div>' +
            '</div>'
    });
}

function changeShow(divId) {
    if (divId == "map") {
        $("#map").show();
        map();
        $("#charts").hide();
        $("#sunny").hide();
        $("#knowledge").hide();
    } else if (divId == "charts") {
        $("#map").hide();
        $("#charts").show();
        charts();
        $("#sunny").hide();
        $("#knowledge").hide();
    } else if (divId == "sunny") {
        $("#map").hide();
        $("#charts").hide();
        $("#sunny").show();
        sunny();
        $("#knowledge").hide();
    } else if (divId == "knowledge") {
        $("#map").hide();
        $("#charts").hide();
        $("#sunny").hide();
        $("#knowledge").show();
        knowledge();
    }
}

function map() {
    var myChart = echarts.init(document.getElementById('map'));
    var days = ['1月20日', '1月21日', '1月22日', '1月23日', '1月24日', '1月25日', '1月26日', '1月27日', '1月28日', '1月29日',
        '1月30日', '1月31日', '2月1日', '2月2日', '2月3日', '2月4日', '2月5日', '2月6日', '2月7日', '2月8日', '2月9日',
        '2月10日', '2月11日', '2月12日'];

    var province = ['湖北', '广东', '浙江', '湖南', '河南', '安徽', '重庆', '山东', '江西', '四川', '江苏',
        '北京', '福建', '上海', '广西', '河北', '陕西', '云南', '海南', '黑龙江', '辽宁', '山西', '天津',
        '甘肃', '内蒙古', '新疆', '宁夏', '吉林', '贵州', '青海', '西藏', '澳门', '香港', '台湾'];

    var provinces = ['hubei', 'guangdong', 'zhejiang', 'hunan', 'henan', 'anhui', 'chongqing', 'shandong', 'jiangxi', 'sichuan',
        'jiangsu', 'beijing', 'fujian', 'shanghai', 'guangxi', 'hebei', 'shanxi', 'yunnan', 'hainan', 'helongjiang', 'liaoning',
        'shanxi', 'tianjin', 'gansu', 'neimenggu', 'xinjiang', 'ningxia', 'jilin', 'guizhou', 'qinghai', 'xizang', 'aomen', 'xiangguang', 'taiwan'];

    /* var provinces = ['shanghai', 'hebei', 'shanxi', 'neimenggu', 'liaoning', 'jilin', 'heilongjiang', 'jiangsu',
        'zhejiang', 'anhui', 'fujian', 'jiangxi', 'shandong', 'henan', 'hubei', 'hunan', 'guangdong', 'guangxi',
        'hainan', 'sichuan', 'guizhou', 'yunnan', 'xizang', 'shanxi1', 'gansu', 'qinghai', 'ningxia', 'xinjiang',
        'beijing', 'tianjin', 'chongqing', 'xianggang', 'aomen'];

    var province = ['上海', '河北', '山西', '内蒙古', '辽宁', '吉林', '黑龙江', '江苏', '浙江', '安徽', '福建',
        '江西', '山东', '河南', '湖北', '湖南', '广东', '广西', '海南', '四川', '贵州', '云南', '西藏', '陕西', '甘肃',
        '青海', '宁夏', '新疆', '北京', '天津', '重庆', '香港', '澳门'];*/

    var seriesData = [{
        name: '北京',
        value: 100
    }, {
        name: '天津',
        value: 0
    }, {
        name: '上海',
        value: 60
    }, {
        name: '重庆',
        value: 0
    }, {
        name: '河北',
        value: 60
    }, {
        name: '河南',
        value: 60
    }, {
        name: '云南',
        value: 0
    }, {
        name: '辽宁',
        value: 0
    }, {
        name: '黑龙江',
        value: 0
    }, {
        name: '湖南',
        value: 60
    }, {
        name: '安徽',
        value: 0
    }, {
        name: '山东',
        value: 60
    }, {
        name: '新疆',
        value: 0
    }, {
        name: '江苏',
        value: 0
    }, {
        name: '浙江',
        value: 0
    }, {
        name: '江西',
        value: 0
    }, {
        name: '湖北',
        value: 60
    }, {
        name: '广西',
        value: 60
    }, {
        name: '甘肃',
        value: 0
    }, {
        name: '山西',
        value: 60
    }, {
        name: '内蒙古',
        value: 0
    }, {
        name: '陕西',
        value: 0
    }, {
        name: '吉林',
        value: 0
    }, {
        name: '福建',
        value: 0
    }, {
        name: '贵州',
        value: 0
    }, {
        name: '广东',
        value: 597
    }, {
        name: '青海',
        value: 0
    }, {
        name: '西藏',
        value: 0
    }, {
        name: '四川',
        value: 60
    }, {
        name: '宁夏',
        value: 0
    }, {
        name: '海南',
        value: 60
    }, {
        name: '台湾',
        value: 0
    }, {
        name: '香港',
        value: 0
    }, {
        name: '澳门',
        value: 0
    }];

    var data = [
        [270, 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],//1.20
        [375, 26, 5, 1, 1, 0, 5, 1, 2, 2, 0, 10, 0, 9, 0, 0, 0, 1, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],//1.21
        [444, 32, 10, 9, 5, 9, 9, 6, 3, 8, 1, 14, 1, 16, 2, 1, 0, 1, 4, 2, 2, 1, 3, 0, 0, 0, 0, 1, 3, 0, 0, 0, 0, 0],//1.22
        [549, 53, 43, 24, 9, 15, 27, 9, 7, 15, 9, 26, 5, 20, 13, 2, 3, 2, 8, 4, 4, 1, 5, 2, 1, 2, 2, 3, 3, 0, 0, 1, 2, 0],//1.23
        [729, 78, 62, 43, 32, 39, 57, 21, 18, 28, 18, 36, 10, 33, 23, 8, 5, 5, 8, 9, 12, 6, 8, 4, 2, 3, 3, 4, 4, 0, 0, 2, 4, 2],//1.24
        [1052, 98, 104, 69, 83, 60, 75, 39, 36, 44, 31, 51, 18, 40, 33, 13, 15, 11, 19, 15, 17, 9, 10, 7, 7, 4, 4, 4, 5, 1, 0, 3, 5, 4],//1.25
        [1423, 146, 128, 100, 128, 70, 110, 63, 48, 69, 47, 68, 29, 53, 46, 18, 22, 16, 22, 21, 22, 13, 14, 14, 11, 5, 7, 6, 7, 4, 0, 4, 6, 6],//1.26
        [2714, 188, 173, 143, 168, 106, 132, 87, 72, 90, 70, 80, 59, 66, 51, 33, 35, 26, 33, 30, 27, 20, 23, 19, 13, 10, 10, 8, 9, 6, 0, 6, 8, 7],//1.27
        [3354, 241, 296, 221, 206, 152, 147, 121, 109, 108, 99, 91, 82, 80, 58, 48, 46, 51, 43, 37, 36, 27, 24, 24, 16, 13, 12, 9, 9, 6, 0, 6, 10, 8],//1.28
        [4586, 311, 428, 277, 278, 200, 165, 130, 162, 108, 99, 111, 84, 96, 58, 48, 56, 55, 43, 38, 39, 35, 27, 24, 16, 13, 12, 9, 9, 6, 1, 7, 10, 8],//1.29
        [5806, 393, 537, 332, 352, 237, 206, 158, 162, 142, 129, 121, 101, 128, 87, 65, 66, 76, 46, 44, 45, 39, 31, 29, 18, 14, 17, 14, 12, 8, 1, 7, 12, 9],//1.30
        [7153, 520, 599, 389, 422, 297, 238, 158, 162, 142, 129, 121, 101, 128, 87, 65, 66, 76, 46, 44, 45, 39, 31, 29, 18, 14, 17, 14, 12, 8, 1, 7, 12, 9],//1.31
        [9074, 604, 661, 463, 493, 340, 262, 158, 162, 142, 129, 121, 101, 128, 87, 65, 66, 76, 46, 44, 45, 39, 31, 29, 18, 14, 17, 14, 12, 8, 1, 7, 12, 9],//2.1
        [11177, 683, 724, 521, 566, 408, 300, 158, 162, 142, 129, 121, 101, 128, 87, 65, 66, 76, 46, 44, 45, 39, 31, 29, 18, 14, 17, 14, 12, 8, 1, 7, 12, 9],//2.2
        [13522, 797, 829, 593, 675, 480, 337, 158, 162, 142, 129, 121, 101, 128, 87, 65, 66, 76, 46, 44, 45, 39, 31, 29, 18, 14, 17, 14, 12, 8, 1, 7, 12, 9],//2.3
        [16678, 870, 895, 661, 764, 530, 366, 158, 162, 142, 129, 121, 101, 128, 87, 65, 66, 76, 46, 44, 45, 39, 31, 29, 18, 14, 17, 14, 12, 8, 1, 7, 12, 9],//2.4
        [19665, 944, 954, 711, 851, 591, 389, 158, 162, 142, 129, 121, 101, 128, 87, 65, 66, 76, 46, 44, 45, 39, 31, 29, 18, 14, 17, 14, 12, 8, 1, 7, 12, 9],//2.5
        [22112, 1018, 1006, 772, 914, 665, 411, 158, 162, 142, 129, 121, 101, 128, 87, 65, 66, 76, 46, 44, 45, 39, 31, 29, 18, 14, 17, 14, 12, 8, 1, 7, 12, 9],//2.6
        [24953, 1075, 1048, 803, 981, 733, 426, 158, 162, 142, 129, 121, 101, 128, 87, 65, 66, 76, 46, 44, 45, 39, 31, 29, 18, 14, 17, 14, 12, 8, 1, 7, 12, 9],//2.7
        [27013, 1120, 1075, 838, 1033, 779, 446, 158, 162, 142, 129, 121, 101, 128, 87, 65, 66, 76, 46, 44, 45, 39, 31, 29, 18, 14, 17, 14, 12, 8, 1, 7, 12, 9],//2.8
        [29631, 1151, 1092, 879, 1073, 830, 468, 158, 162, 142, 129, 121, 101, 128, 87, 65, 66, 76, 46, 44, 45, 39, 31, 29, 18, 14, 17, 14, 12, 8, 1, 7, 12, 9],//2.9
        [31728, 1177, 1117, 912, 1105, 860, 486, 158, 162, 142, 129, 121, 101, 128, 87, 65, 66, 76, 46, 44, 45, 39, 31, 29, 18, 14, 17, 14, 12, 8, 1, 7, 12, 9],//2.10
        [33366, 1219, 1131, 946, 1135, 889, 505, 158, 162, 142, 129, 121, 101, 128, 87, 65, 66, 76, 46, 44, 45, 39, 31, 29, 18, 14, 17, 14, 12, 8, 1, 7, 12, 9],//2.11
        [48206, 1241, 1145, 968, 1169, 910, 518, 158, 162, 142, 129, 121, 101, 128, 87, 65, 66, 76, 46, 44, 45, 39, 31, 29, 18, 14, 17, 14, 12, 8, 1, 7, 12, 9],//2.12
    ];


    var option = {
        baseOption: {
            //时间轴
            timeline: {
                //show: false,
                axisType: 'category',
                realtime: false,
                loop: false,
                autoPlay: false,
                playInterval: 2000,
                symbolSize: 12,
                //left: '5%',
                right: '0',
                bottom: '0',
                width: '400',
                height: '65',
                controlStyle: {
                    position: 'left'
                },
                data: days,
                tooltip: {
                    formatter: days
                },
                label: {
                    show: true,
                        interval: 'auto',
                    rotate: 50,
                    formatter: null,
                    textStyle: {
                        color: '#000000'
                    }
                }
            },

            tooltip: {
                show: true,
                formatter: function (params) {
                    return params.name + '：' + params.data['value']
                },
            },
            visualMap: {
                type: 'piecewise',
                pieces: [{
                    min: 1001,
                    color: '#73240D'
                },
                    {
                        min: 20001,
                        max: 30000,
                        color: '#030020'
                    },
                    {
                        min: 10000,
                        max: 20000,
                        color: '#330006'
                    },
                    {
                        min: 1001,
                        max: 9999,
                        color: '#BB0000'
                    },
                    {
                        min: 501,
                        max: 1000,
                        color: '#BD430A'
                    },
                    {
                        min: 101,
                        max: 500,
                        color: '#E08150'
                    },
                    {
                        min: 11,
                        max: 100,
                        color: '#E9B090'
                    },
                    {
                        min: 1,
                        max: 10,
                        color: '#F2DDD2'
                    },
                    {
                        value: 0,
                        color: 'white'
                    }
                ],
                orient: 'vertical',
                itemWidth: 25,
                itemHeight: 15,
                showLabel: true,
                seriesIndex: [0],

                textStyle: {
                    color: '#7B93A7'
                },
                bottom: '20',
                left: "70",
            },
            //右侧排名
            grid: {
                right: '15',
                bottom: '100',
                width: '300',
                height: '360'
            },
            xAxis: {
                min: 0,
                max: 100000,
                show: false
            },
            yAxis: [{
                inverse: true,
                offset: '2',
                type: 'category',
                data: '',
                nameTextStyle: {
                    color: '#fff'
                },
                axisTick: {
                    show: false,
                },
                axisLabel: {
                    //rotate:45,
                    textStyle: {
                        fontSize: 14,
                        color: '#000000',
                    },
                    interval: 0
                },
                axisLine: {
                    show: false,
                    lineStyle: {
                        color: '#333'
                    },
                },
                splitLine: {
                    show: false,
                    lineStyle: {
                        color: '#333'
                    }
                },
            }],
            //地图
            geo: {
                map: 'china',
                right: '390',
                left: '70',
                label: {
                    show: true,
                    emphasis: {
                        show: true,
                    }
                },
                itemStyle: {
                    emphasis: {
                        show: true,
                        areaColor: '#00FF00'
                    }
                }
            },
            series: [{
                name: 'mapSer',
                type: 'map',
                map: 'china',
                roam: false,
                geoIndex: 0,
                label: {
                    show: false,
                },
            },
                {
                    name: '',
                    type: 'bar',
                    zlevel: 2,
                    barWidth: '40%',
                    label: {
                        normal: {
                            show: true,
                            fontSize: 14,
                            position: 'right',
                            formatter: '{c}'
                        }
                    },
                }
            ],

        },
        animationDurationUpdate: 3000,
        animationEasingUpdate: 'quinticInOut',
        options: []
    };
    for (var n = 0; n < days.length; n++) {

        var res = [];
        for (j = 0; j < data[n].length; j++) {
            res.push({
                name: province[j],
                value: data[n][j]
            });
        }
        res.sort(function (a, b) {
            return b.value - a.value;
        }).slice(0, 6);

        res.sort(function (a, b) {
            return a.value - b.value;
        });
        var res1 = [];
        var res2 = [];
        for (t = 0; t < 10; t++) {
            res1[t] = res[res.length - 1 - t].name;
            res2[t] = res[res.length - 1 - t].value;
        }
        console.log(res1);
        console.log("----------------");
        console.log(province);
        option.options.push({
            title: [{
                //text: days[n] + '新型冠状病毒全国感染人数',
                textStyle: {
                    color: '#2D3E53',
                    fontSize: 28
                },
                left: 20,
                top: 20,
            },
                {
                    show: true,
                    text: days[n],     //'感染人数前十的省份',
                    textStyle: {
                        color: '#2D3E53',
                        fontSize: 18
                    },
                    right: '280',
                    bottom: '470'
                }
            ],
            yAxis: {
                data: res1,
            },
            series: [{
                type: 'map',
                data: res
            }, {
                type: 'bar',
                data: res2,
                itemStyle: {
                    normal: {
                        color: function (params) {
                            // build a color map as your need.
                            var colorList = [{
                                colorStops: [{
                                    offset: 0,
                                    color: '#FF0000' // 0% 处的颜色
                                }, {
                                    offset: 1,
                                    color: '#990000' // 100% 处的颜色
                                }]
                            },
                                {
                                    colorStops: [{
                                        offset: 0,
                                        color: '#00C0FA' // 0% 处的颜色
                                    }, {
                                        offset: 1,
                                        color: '#2F95FA' // 100% 处的颜色
                                    }]
                                }
                            ];
                            if (params.dataIndex < 3) {
                                return colorList[0]
                            } else {
                                return colorList[1]
                            }
                        },
                    }
                },
            }]
        });
    }
    myChart.setOption(option);


    /*initEcharts("china", "中国");

    function initEcharts(pName, Chinese_) {
        var tmpSeriesData = pName === "china" ? seriesData : [];
        var option = {
            series: [
                {
                    name: Chinese_ || pName,
                    type: 'map',
                    mapType: pName,
                    roam: false,//是否开启鼠标缩放和平移漫游
                    data: tmpSeriesData,
                    top: "3%",//组件距离容器的距离
                    zoom:1.1,
                    selectedMode : 'single',

                    label: {
                        normal: {
                            show: true,//显示省份标签
                            textStyle:{color:"#fbfdfe"}//省份标签字体颜色
                        },
                        emphasis: {//对应的鼠标悬浮效果
                            show: true,
                            textStyle:{color:"#323232"}
                        }
                    },
                    itemStyle: {
                        normal: {
                            borderWidth: .5,//区域边框宽度
                            borderColor: '#0550c3',//区域边框颜色
                            areaColor:"#4ea397",//区域颜色

                        },

                        emphasis: {
                            borderWidth: .5,
                            borderColor: '#4b0082',
                            areaColor:"#ece39e",
                        }
                    },
                }
            ],
            title: {
                text: Chinese_ || pName,
                left: 'center'
            },
            tooltip: {
                trigger: 'item',
                formatter: '{b}<br/>{c} (p / km2)'
            },
            baseOption: {
                //时间轴
                timeline: {
                    axisType: 'category',
                    realtime: false,
                    loop: false,
                    autoPlay: false,
                    playInterval: 2000,
                    symbolSize: 12,
                    left: '5%',
                    right: '5%',
                    bottom: '0%',
                    width: '90%',
                    controlStyle: {
                         position: 'left'
                    },
                    data: days,
                    tooltip: {
                        formatter: days
                    },
                },

                tooltip: {
                    show: true,
                    formatter: function(params) {
                        return params.name + '：' + params.data['value']
                    },
                },
                visualMap: {
                    type: 'piecewise',
                    pieces: [{
                        min: 1001,
                        color: '#73240D'
                    },
                        {
                            min: 20001,
                            max: 30000,
                            color: '#030020'
                        },
                        {
                            min: 10000,
                            max: 20000,
                            color: '#330006'
                        },
                        {
                            min: 1001,
                            max: 9999,
                            color: '#BB0000'
                        },
                        {
                            min: 501,
                            max: 1000,
                            color: '#BD430A'
                        },
                        {
                            min: 101,
                            max: 500,
                            color: '#E08150'
                        },
                        {
                            min: 11,
                            max: 100,
                            color: '#E9B090'
                        },
                        {
                            min: 1,
                            max: 10,
                            color: '#F2DDD2'
                        },
                        {
                            value: 0,
                            color: 'white'
                        }
                    ],
                    orient: 'vertical',
                    itemWidth: 25,
                    itemHeight: 15,
                    showLabel: true,
                    seriesIndex: [0],

                    textStyle: {
                        color: '#7B93A7'
                    },
                    bottom: '10%',
                    left: "5%",
                },
                grid: {
                    right: '5%',
                    top: '20%',
                    bottom: '10%',
                    width: '20%'
                },
                xAxis: {
                    min:0,
                    max:100000,
                    show: false
                },
                yAxis: [{
                    inverse: true,
                    offset: '2',
                    type: 'category',
                    data: '',
                    nameTextStyle: {
                        color: '#fff'
                    },
                    axisTick: {
                        show: false,
                    },
                    axisLabel: {
                        //rotate:45,
                        textStyle: {
                            fontSize: 14,
                            color: '#000000',
                        },
                        interval: 0
                    },
                    axisLine: {
                        show: false,
                        lineStyle: {
                            color: '#333'
                        },
                    },
                    splitLine: {
                        show: false,
                        lineStyle: {
                            color: '#333'
                        }
                    },
                }],
                geo: {
                    map: 'china',
                    right: '32%',
                    left: '8%',
                    label: {
                        emphasis: {
                            show: false,
                        }
                    },
                    itemStyle: {
                        emphasis: {
                            areaColor: '#00FF00'
                        }
                    }
                },
                series: [{
                    name: 'mapSer',
                    type: 'map',
                    map: 'china',
                    roam: false,
                    geoIndex: 0,
                    label: {
                        show: false,
                    },
                },
                    {
                        name: '',
                        type: 'bar',
                        zlevel: 2,
                        barWidth: '40%',
                        label: {
                            normal: {
                                show: true,
                                fontSize: 14,
                                position: 'right',
                                formatter: '{c}'
                            }
                        },
                    }
                ],

            },
            animationDurationUpdate: 3000,
            animationEasingUpdate: 'quinticInOut',
            options: []
        };
        for (var n = 0; n < days.length; n++) {

            var res = [];
            for (j = 0; j < data[n].length; j++) {
                res.push({
                    name: province[j],
                    value: data[n][j]
                });
            }
            res.sort(function(a, b) {
                return b.value - a.value;
            }).slice(0, 6);

            res.sort(function(a, b) {
                return a.value - b.value;
            });
            var res1 = [];
            var res2 = [];
            for (t = 0; t < 10; t++) {
                res1[t] = res[res.length - 1 - t].name;
                res2[t] = res[res.length - 1 - t].value;
            }
            console.log(res1);
            console.log("----------------");
            console.log(province);
            option.options.push({
                title: [{
                    //text: days[n] + '新型冠状病毒全国感染人数',
                    textStyle: {
                        color: '#2D3E53',
                        fontSize: 28
                    },
                    left:20,
                    top:20,
                },
                    {
                        show: true,
                        text: '感染人数前十的省份',
                        textStyle: {
                            color: '#2D3E53',
                            fontSize: 18
                        },
                        right: '10%',
                        top: '15%'
                    }
                ],
                yAxis: {
                    data: res1,
                },
                series: [{
                    type: 'map',
                    data: res
                }, {
                    type: 'bar',
                    data: res2,
                    itemStyle: {
                        normal: {
                            color: function(params) {
                                // build a color map as your need.
                                var colorList = [{
                                    colorStops: [{
                                        offset: 0,
                                        color: '#FF0000' // 0% 处的颜色
                                    }, {
                                        offset: 1,
                                        color: '#990000' // 100% 处的颜色
                                    }]
                                },
                                    {
                                        colorStops: [{
                                            offset: 0,
                                            color: '#00C0FA' // 0% 处的颜色
                                        }, {
                                            offset: 1,
                                            color: '#2F95FA' // 100% 处的颜色
                                        }]
                                    }
                                ];
                                if (params.dataIndex < 3) {
                                    return colorList[0]
                                } else {
                                    return colorList[1]
                                }
                            },
                        }
                    },
                }]
            });
        }
        myChart.setOption(option);
        myChart.off("click");

        if (pName === "china") { // 全国时，添加click 进入省级
            myChart.on('click', function (param) {
                console.log(param.name);
                // 遍历取到province 中的下标  去拿到对应的省js
                for (var i = 0; i < province.length; i++) {
                    if (param.name === province[i]) {
                        //显示对应省份的方法
                        showProvince(provinces[i], province[i]);
                        break;
                    }
                }
                if (param.componentType === 'series') {
                    var provinceName =param.name;
                    $('#box').css('display','block');
                    $("#box-title").html(provinceName);

                }
            });
        } else { // 省份，添加双击 回退到全国
            myChart.on("dblclick", function () {
                initEcharts("china", "中国");
            });
        }
    }

    // 展示对应的省
    function showProvince(pName, Chinese_) {
        //这写省份的js都是通过在线构建工具生成的，保存在本地，需要时加载使用即可，最好不要一开始全部直接引入。
        loadBdScript('$' + pName + 'JS', './scripts/province/' + pName + '.js', function () {
            initEcharts(Chinese_);
        });
    }

    // 加载对应的JS
    function loadBdScript(scriptId, url, callback) {
        var script = document.createElement("script");
        script.type = "text/javascript";
        if (script.readyState) {  //IE
            script.onreadystatechange = function () {
                if (script.readyState === "loaded" || script.readyState === "complete") {
                    script.onreadystatechange = null;
                    callback();
                }
            };
        } else {  // Others
            script.onload = function () {
                callback();
            };
        }
        script.src = url;
        script.id = scriptId;
        document.getElementsByTagName("head")[0].appendChild(script);
    }*/
}

//第二个导航
function charts() {
    var myChart = echarts.init(document.getElementById('charts'));
    var option = {
        title: {
            text: "  每日新增确诊病例",
            textStyle: {
                color: '#034c6a',
                fontSize: 14,
                fontWeight: true,
            },
        },
        tooltip: {
            trigger: "axis",
            axisPointer: {
                type: "shadow",
            },
            color: '#034c6a'
        },
        grid: {
            borderWidth: 0,
            top: 35,
            bottom: 25,
            color: '#034c6a'
        },
        toolbox: {
            show: true,
            feature: {
                dataZoom: {
                    yAxisIndex: 'none'
                },
                dataView: {readOnly: false},
                magicType: {type: ['line', 'bar']},
                restore: {},
                saveAsImage: {}
            }
        },
        calculable: true,
        dataZoom: [{
            show: true,
            height: 20,
            xAxisIndex: [
                0
            ],
            bottom: 10,
            start: 10,
            end: 80,
            handleIcon: 'path://M306.1,413c0,2.2-1.8,4-4,4h-59.8c-2.2,0-4-1.8-4-4V200.8c0-2.2,1.8-4,4-4h59.8c2.2,0,4,1.8,4,4V413z',
            handleSize: '110%',
        }, {
            type: "inside",
            show: true,
            height: 15,
            start: 1,
            end: 35
        }],
        xAxis: [{
            type: "category",
            axisLine: {
                show: true,
                lineStyle: {
                    color: 'rgba(255,255,255,1)'
                }
            },
            splitLine: {
                show: false,
                lineStyle: {
                    color: '#034c6a'
                }
            },
            axisTick: {
                show: true
            },
            splitArea: {
                show: false
            },
            axisLabel: {
                interval: 1,
                rotate: 30,
                textStyle: {
                    color: '#034c6a',
                },
            },
            data: ['1.10', '1.11', '1.12', '1.13', '1.14', '1.15', '1.16', '1.17', '1.18', '1.19', '1.20', '1.21', '1.22',
                '1.23', '1.24', '1.25', '1.26', '1.27', '1.28', '1.29', '1.30', '1.31', '2.1', '2.2',
                '2.3', '2.4', '2.5', '2.6', '2.7', '2.8', '2.9']
        }],
        yAxis: [{
            type: "value",
            axisLine: {
                show: true,
                lineStyle: {
                    color: 'rgba(255,255,255,1)'
                }
            },
            splitLine: {
                show: false
            },
            axisTick: {
                show: false
            },
            axisLabel: {
                interval: 0,
                textStyle: {
                    color: '#034c6a',
                },
            },
            splitArea: {
                show: false
            },
        }],
        dataZoom: [{
            show: false,
            height: 30,
            xAxisIndex: [
                0
            ],
            bottom: 30,
            start: 10,
            end: 80,
            handleIcon: 'path://M306.1,413c0,2.2-1.8,4-4,4h-59.8c-2.2,0-4-1.8-4-4V200.8c0-2.2,1.8-4,4-4h59.8c2.2,0,4,1.8,4,4V413z',
            handleSize: '110%',
        }, {
            type: "inside",
            show: true,
            height: 15,
            start: 1,
            end: 35
        }],
        legend: {
            textStyle: {
                color: '#034c6a',
            },
            top: '11%',
            data: ['每日新增确诊病例', '累计确诊人数', '每日累计治愈出院病例', '每日累计死亡病例', '每日新增治愈出院病例', '每日新增死亡病例']
        },
        series: [{
            name: '每日新增确诊病例',
            type: "line",
            symbolSize: 10,
            symbol: 'circle',
            smooth: true,
            itemStyle: {
                normal: {
                    color: "red",
                    barBorderRadius: 0,
                    label: {
                        show: true,
                        position: "top",
                        formatter: function (p) {
                            return p.value > 0 ? (p.value) : '';
                        }
                    }
                }
            },
            data: [0, 0, 0, 0, 0, 0, 4, 17, 59, 77, 77, 149, 131, 259, 444, 688, 769, 1771,
                1459, 1737, 1982, 2102, 2590, 2829, 3235, 3887, 3694, 3143, 3399, 2656, 3062]
        }, {
            name: '累计确诊人数',
            type: "line",
            symbolSize: 10,
            symbol: 'circle',
            smooth: true,
            itemStyle: {
                normal: {
                    color: "rgba(252,230,48,1)",
                    barBorderRadius: 0,
                    label: {
                        show: true,
                        position: "top",
                        formatter: function (p) {
                            return p.value > 0 ? (p.value) : '';
                        }
                    }
                }
            },
            data: [41, 41, 41, 41, 41, 41, 45, 62, 121, 198, 291, 440, 571, 830, 1287, 1975, 2744, 4515,
                5974, 7711, 9692, 11791, 14380, 17205, 20438, 24324, 28018, 31161, 34546, 37198, 40171]
        }, {
            name: '每日累计治愈出院病例',
            type: 'line',
            smooth: true, //是否平滑
            showAllSymbol: true,
            symbol: 'circle',
            symbolSize: 4,
            lineStyle: {
                normal: {
                    color: "#6c50f3",
                },
            },
            label: {
                show: true,
                position: 'top',
                textStyle: {
                    color: '#6c50f3',
                }
            },
            itemStyle: {
                color: "#6c50f3",
                borderColor: "#fff",
                borderWidth: 1,
            },
            areaStyle: {
                normal: {
                    color: new echarts.graphic.LinearGradient(0, 0, 0, 1)
                }
            },
            data: [2, 6, 7, 7, 7, 12, 15, 19, 24, 25, , , , 34, 38, 49, 51, 60, 103, 124, 171, 243, 328, 475, 632, 892, 1153, 1540, 2050, 2649, 3281]
        },
            {
                name: '每日累计死亡病例',
                type: 'line',
                smooth: true, //是否平滑
                showAllSymbol: true,
                symbol: 'circle',
                symbolSize: 4,
                lineStyle: {
                    normal: {
                        color: "#00ca95",
                    },
                },
                label: {
                    show: true,
                    position: 'top',
                    textStyle: {
                        color: '#00ca95',
                    }
                },

                itemStyle: {
                    color: "#00ca95",
                    borderColor: "#fff",
                    borderWidth: 1,
                },
                areaStyle: {
                    normal: {
                        color: new echarts.graphic.LinearGradient(0, 0, 0, 1)
                    }
                },
                data: [1, 1, 1, 1, 1, 2, 2, 2, 3, 4, 7, 13, 17, 25, 41, 56, 80, 106, 132, 170, 213, 259, 304, 361, 425, 490, 563, 636, 722, 811, 908],
            }, {
                name: '每日新增治愈出院病例',
                type: 'line',
                smooth: true, //是否平滑
                showAllSymbol: true,
                symbol: 'circle',
                symbolSize: 4,
                lineStyle: {
                    normal: {
                        color: "green",
                    },
                },
                label: {
                    show: true,
                    position: 'top',
                    textStyle: {
                        color: 'green',
                    }
                },
                itemStyle: {
                    color: "green",
                    borderColor: "#fff",
                    borderWidth: 1,
                },
                areaStyle: {
                    normal: {
                        color: new echarts.graphic.LinearGradient(0, 0, 0, 1,)
                    }
                },
                data: [2, 4, 1, 0, 0, 5, 3, 4, 5, 1, , , , 6, 3, 11, 2, 9, 43, 21, 47, 72, 85, 147, 157, 262, 261, 387, 510, 600, 632]
            },
            {
                name: '每日新增死亡病例',
                type: 'line',
                smooth: true, //是否平滑
                showAllSymbol: true,
                symbol: 'circle',
                symbolSize: 4,
                lineStyle: {
                    normal: {
                        color: "#C32193",
                        shadowColor: 'rgba(0, 0, 0, .3)',
                        shadowBlur: 0,
                        shadowOffsetY: 5,
                        shadowOffsetX: 5,
                    },
                },
                label: {
                    show: true,
                    position: 'top',
                    textStyle: {
                        color: '#C32193',
                    }
                },

                itemStyle: {
                    color: "#C32193",
                    borderColor: "#fff",
                    borderWidth: 1,
                },
                areaStyle: {
                    normal: {
                        color: new echarts.graphic.LinearGradient(0, 0, 0, 1)
                    }
                },
                data: [1, 0, 0, 0, 0, 1, 0, 0, 1, 1, 3, 6, 4, 8, 16, 15, 24, 26, 26, 38, 43, 46, 45, 57, 64, 65, 73, 73, 86, 89, 97],
            }]
    }
    myChart.setOption(option);
}

function sunny() {
	
}

function knowledge() {

}